package com.javafactroy.kunlong.domain.generalright.repository;

import com.javafactroy.kunlong.base.model.ReturnPageInfo;
import com.javafactroy.kunlong.data.dto.EmpInfoApiDto;
import com.javafactroy.kunlong.data.entity.EmpInfoApiEntity;
import com.javafactroy.kunlong.data.service.EmpInfoService;
import com.javafactroy.kunlong.domain.generalright.agg.DptRightAgg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class DptRightRepository {

    @Autowired
    EmpInfoService empInfoService;

    public DptRightAgg load(Long id) {
        DptRightAgg agg = new DptRightAgg().setDptId(id);
        ReturnPageInfo<EmpInfoApiEntity> pageInfo = empInfoService.query(new EmpInfoApiDto().setDeptId(id));
        return agg.setEmpInfos(pageInfo.getList());
    }
}
